package com.cskaoyan.controller;

import com.cskaoyan.service.StatService;
import com.cskaoyan.vo.BaseRespVo;
import com.cskaoyan.vo.GoodsStatisticsVo;
import com.cskaoyan.vo.OrderStatisticsVo;
import com.cskaoyan.vo.UserStatisticsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StatController {

    @Autowired
    StatService statService;

    /**
     * 功能:用户统计页面
     * 作者:whj
     */
    @RequestMapping("/admin/stat/user")
    public BaseRespVo userStat(){
        UserStatisticsVo userStatisticsVo = statService.userStat();
        return BaseRespVo.ok(userStatisticsVo);
    }

    /**
     * 功能:订单统计页面
     * 作者:whj
     */
    @RequestMapping("/admin/stat/order")
    public BaseRespVo orderStat(){
        OrderStatisticsVo orderStat = statService.orderStat();
        return BaseRespVo.ok(orderStat);
    }

    /**
     * 功能:商品统计页面
     * 作者:whj
     */
    @RequestMapping("/admin/stat/goods")
    public BaseRespVo goodsStat(){
        GoodsStatisticsVo goodsStat = statService.goodsStat();
        return BaseRespVo.ok(goodsStat);
    }
}
